|
|
|
| |
|
|
|
|
There are several advantages to using a Main() routine as the startup for your application. You can handle numerous initialization processes before you load a form, and you can even design your application to use different forms from the same Main() routine. Programs that start with a Main() routine are usually easier to maintain and modify than programs that start with a startup form. |
|
|
|
|
|
|
|
|
|
|
Now save the new module as modUsrTest.bas and the project as prjUsrTest.vbp, and run the project. Your screen should look similar to the one in Figure 21.2. |
|
|
|
|
|
|
|
|
Figure 21.2.
Running the User Maintenance form. |
|
|
|
|
|
|
|
|
You can now add, edit, and delete user records. A few records have already been added for you. Make sure this includes a record for USERA. If one does not exist, add it. If it is already on file, edit the record and set the Password field to USERA. Notice that the Password field does not display its contents. This is because you set the PasswordChar property of the textbox to show only an asterisk (*) for every character in the field. The actual characters are stored in the database table. |
|
|
|
|
|
|
|
|
Building the User LogIn and LogOut Routines |
|
|
|
|
|
|
|
|
Now that you have a method for managing the list of valid users, it's time to create the routines that enable users to log into and out of your applications. First you need to create a user login form. Then you need to add a routine to verify the user login and a routine to log the user out when the application is terminated. |
|
|
|
|
|
|
|
|
First, build the user login form. Add a new form to the existing PRJUSROBJECT.VBP project, using Table 21.2 and Figure 21.3 as guides in building the form. |
|
|
|
|
|